define(function(require, exports){
	var pubjs = require('pubjs');
	var grid = require('@base/highGrid');
	// var $ = require('jquery');

	// amount渠道
	var channel = grid.base.extend({
		init: function(config){
			config = pubjs.conf(config, {
				url: 'campaign/amountSubgrid',
				param: {
					'IsDeleted': false
					,'Type': 'channel'
				},
				cols: [
					{"type":"id"},
					{"name":"Channel","type":"index","text":LANG("渠道"),width:120,render:'renderName'},
					{"name":"Channel_Type", "text":LANG("类型"),width:100, align: 'left',render:'renderName'}
				],
				// 也有竞价组
				//tab: pubjs.config('metricsGroup/mixDimension/tabs'),
				default_metrics : pubjs.config('defaultMetrics'),
				hasSwitch: false,
				hasSubGrid: false,
				reqType: 'websocket',
				hasFilter: false,
				gridName: 'campaign_amountSubgrid'
			});
			this.Super('init', arguments);
		}
		,renderName: function(i, val, data, con){
			return '<div class="text-truncate" title="'+val+'">'+val+'</div>';
		}
		,onSubgridParam: function(ev){
			var self = this;
			var c = self.getConfig();
			// 汇总子表格时，需要同步更新
			if(c.syncParentGridParam){
				// self.reload(ev.param.data); // 暂时不自动加载，只设参数，需要手动重新load
				self.setParam(ev.param.data);
			}
		}
		// 响应日期条事件
		,onDateRangeChange: function(ev){
			if(!this.getDOM().is(':visible')){
				return false;
			}
			// 设置日期参数
			var param = ev.param.nowTimestamp;
			this.reload(param);
			return false;
		}
	});
	exports.channel = channel;
});